From 56022b307133da3b9efc728ecbe37fa6b883c1b9 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Thu, 27 May 2010 08:26:52 +0100 Subject: [PATCH] libxl: Do not provide arbitrary string as format specifier to printf. Original patch from Dulloor Signed-off-by: Keir Fraser --- tools/libxl/xl_cmdimpl.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 0fe6be9116..85c6e1b129 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -3267,13 +3267,8 @@ int main_dmesg(int argc, char **argv) if (!cr) goto finish; - while (1) { - ret = libxl_xen_console_read_line(&ctx, cr, &line); - if (ret > 0) - printf(line); - else - break; - } + while ((ret = libxl_xen_console_read_line(&ctx, cr, &line)) > 0) + printf("%s", line); finish: libxl_xen_console_read_finish(&ctx, cr); -- 2.30.2